#include<stdio.h>
#include <unistd.h>
#include <sys/wait.h>


int main() {
	pid_t pid;
	pid = fork();
	if (pid == 0) {
		printf("child pid is %d\n", getpid());
		printf("child gid is %d\n", getpgid(0));
		printf("child sid is %d\n", getsid(0));
		sleep(2);
		printf("------------\n");
		printf("child pid is %d\n", getpid());
		printf("child gid is %d\n", getpgid(0));
		printf("child sid is %d\n", getsid(0));
	} else if (pid > 0) {
	} else {
		perror("fork error");
	}

	return 0;
}
